// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
/*eslint-disable*/
import Vue from 'vue'
import App from './App'
import Vuex from 'vuex'
import store from './store'
import router from './router'
import VueStorage from 'vue-ls'
// import { InfiniteScroll } from 'mint-ui';
import Vant from 'vant';
import 'vant/lib/index.css';
// 


import FastClick from 'fastclick'
import '../static/js/flexible.js'
import Video from 'video.js'
import 'video.js/dist/video-js.css'

import './utils/filter'

import './permission'

// import VueLazyload from 'vue-lazyload'
import { Lazyload } from 'vant';

import infiniteScroll from 'vue-infinite-scroll'
Vue.use(infiniteScroll)

//兼容白屏
import 'babel-polyfill'
import Es6Promise from 'es6-promise'
require('es6-promise').polyfill()
Es6Promise.polyfill()

// Vue.use(InfiniteScroll);
Vue.use(Vant);
// Vue.use(Lazyload)

Vue.use(Lazyload, {
  preLoad: 2,
  error: 'static/error.png',
  loading: 'static/loading.gif',
  attempt: 2
})

let options = {
  namespace: 'vuels__',
  name: 'ls',
  storage: 'local'
}

Vue.prototype.$video = Video

Vue.prototype.$dispatch = function (eventName, value) {
  let parent = this.$parent; // 先找第一层的$parent
  while (parent) {
    parent.$emit(eventName, value); // 触发方法
    parent = parent.$parent; // 接着向上找
  }
}

Vue.use(Vuex)

Vue.use(VueStorage, options)


Vue.config.productionTip = false
FastClick.attach(document.body)

new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
